package com.service.impl;

import com.mapper.CommodityMapper;
import com.pojo.Classify;
import com.pojo.Commodity;
import com.pojo.Sell;
import com.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class CommodityServiceImpl implements CommodityService {
    @Autowired
    public CommodityMapper mapper;
    //查询库存
    @Override
    public List<Commodity> commodityFindAll(Integer cid, String cname, String ctype) {
        return mapper.commodityFindAll(cid, cname, ctype);
    }

    //入库(添加)
    @Override
    public int commodityInsert(Commodity commodity) {
        return mapper.commodityInsert(commodity);
    }


    //入库（修改）
    @Override
    public int commodityUpdCount(Integer cid, Integer count) {
        return mapper.commodityUpdCount(cid, count);
    }

    //    通过编号查询库存
    @Override
    public List<Commodity> commodityFindByCid(Integer cid) {
        return mapper.commodityFindByCid(cid);
    }


    //商品分类查询
    @Override
    public List<Classify> classifySelect(Integer tid) {
        return mapper.classifySelect(tid);
    }


    //    商品售价修改
    @Override
    public int commodityUpdSprice(Integer cid, BigDecimal sprice,Integer empno) {
        return mapper.commodityUpdSprice(cid, sprice,empno);
    }
    @Override
    public int sellUpdSprice(Integer cid, BigDecimal sprice,Integer empno) {
        return mapper.sellUpdSprice(cid, sprice,empno);
    }
    @Override
    public int sellInsert(Sell sell) {
        return mapper.sellInsert(sell);
    }


    //    查询货架表
    @Override
    public List<Map<String,Object>> sellSelect(Integer sid, Integer cid) {
        return mapper.sellSelect(sid, cid);
    }


    //    修改货架数量
    @Override
    public int sellUpdSnum(Integer cid, Double snum) {
        return mapper.sellUpdSnum(cid, snum);
    }
}
